﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using turnos.escritorio;

namespace turnos.escritorio
{
    public partial class FrmPrincipal : Form
    {
        public FrmPrincipal()
        {
            InitializeComponent();
        }

        private void salirToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (DialogResult.Yes == MessageBox.Show("¿Esta seguro que desea salir?", "Sistema de Gestion de turnos", MessageBoxButtons.YesNo))
            {
                this.Close();
            }
        }

        private void conceptosToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmAltaDeMatriz frm = new frmAltaDeMatriz();
            frm.MdiParent=this;
            frm.Show();
        }

        
        private void FrmPrincipal_FormClosed(object sender, FormClosedEventArgs e)
        {
            Application.Exit();
        }

        private void altaDeEscenarioToolStripMenuItem_Click(object sender, EventArgs e)
        {

            frmAsignacionTurnos frm = new frmAsignacionTurnos();
            frm.MdiParent = this;
            frm.Show();
            
        }

        private void administrarToolStripMenuItem_Click(object sender, EventArgs e)
        {
            
        }

        private void preliquidadorToolStripMenuItem_Click(object sender, EventArgs e)
        {
            
        }

        private void visualizarMatricesGeneradasToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmVisorMatriz frm = new frmVisorMatriz();
            frm.MdiParent = this;
            frm.Show();
        }

        private void atenciónDeTurnoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmAtencionTurnos frm = new frmAtencionTurnos();
            frm.MdiParent = this;
            frm.Show();
        }

        private void visorDeProximoTurnoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmVisorTurnoActual frm = new frmVisorTurnoActual();
            frm.ShowDialog();
        }

        private void finalizarTurnoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmFinalizarTurnos frm = new frmFinalizarTurnos();
            frm.MdiParent = this;
            frm.Show();
        }

        private void FrmPrincipal_Load(object sender, EventArgs e)
        {
            if (Modelo.TurnosModelo.Usuario.Rol == "Administrador")
            {
                tablasToolStripMenuItem.Visible = true;
                usuariosToolStripMenuItem.Visible = true;
            }
            else
            {
                tablasToolStripMenuItem.Visible = false;
                usuariosToolStripMenuItem.Visible = false;

                altaDeEscenarioToolStripMenuItem.Visible = false;
                atenciónDeTurnoToolStripMenuItem.Visible = false;
                recepcionDeTurnoToolStripMenuItem.Visible = false;
                visorDeProximoTurnoToolStripMenuItem.Visible = false;
                finalizarTurnoToolStripMenuItem.Visible = false;
                progresoDeTurnosToolStripMenuItem.Visible = false;
                listadoDeTurnosWebToolStripMenuItem.Visible = true;
                
                if (Modelo.TurnosModelo.Usuario.Rol == "Recepcion")
                {
                    recepcionDeTurnoToolStripMenuItem.Visible = true;
                    progresoDeTurnosToolStripMenuItem.Visible = true;
                }
                if (Modelo.TurnosModelo.Usuario.Rol == "Visor")
                    visorDeProximoTurnoToolStripMenuItem.Visible = true;
                if (Modelo.TurnosModelo.Usuario.Rol == "Box")
                {
                    atenciónDeTurnoToolStripMenuItem.Visible = true;
                    finalizarTurnoToolStripMenuItem.Visible = true;
                }
                if (Modelo.TurnosModelo.Usuario.Rol == "Asignacion")
                    altaDeEscenarioToolStripMenuItem.Visible = true;
                    
            }
        }

        private void usuariosToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmAMUsuarios frm = new frmAMUsuarios();
            frm.MdiParent = this;
            frm.Show();
        }

        private void listadoDeTurnosWebToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmListadoTurnosWeb frm = new frmListadoTurnosWeb();
            frm.MdiParent = this;
            frm.Show();
        }

        private void recepcionDeTurnoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmRecepcionTurnos frm = new frmRecepcionTurnos();
            frm.MdiParent = this;
            frm.Show();
        }

        private void progresoDeTurnosToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmTurnosEnVisor frm = new frmTurnosEnVisor();
            frm.MdiParent = this;
            frm.Show();
        }

        private void buscarTurnosDeUnaPersonaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmBuscarTurnos frm = new frmBuscarTurnos();
            frm.MdiParent = this;
            frm.Show();
        }

    }
}
